﻿
@{
    ViewBag.Title = "EquTypeAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <style>
        th {
            text-align: center;
            font-weight: bold;
        }

        #location {
            position: absolute;
            z-index: 100;
            width: 10px;
            height: 10px;
            color: red;
            font-weight: bold;
        }
        #location2{
            position: absolute;
            z-index: 100;
            width: 10px;
            height: 10px;
            color: red;
            font-weight: bold;
        }

        td {
            text-align: center;
            vertical-align: middle;
        }

        .div-relative {
            position: relative;
        }

        .div-a {
            position: absolute;
        }

        .detail_div {
            background-color: rgba(0,0,0,0.5);
            color: white;
            border-radius: 4px;
            z-index: 999;
            position: fixed;
            width: 300px;
        }

        .detail_text {
            display: none;
            font-size: 16px;
        }
    </style>
}
<div class="page-content" ng-cloak ng-controller="FireControlController" ng-init="AddModel={};MapId='@(Request.QueryString["Id"].IsEmpty() ? "1" : Request.QueryString["Id"])';
     GetMapInfo(MapId);
     GetPointList(MapId);
     GetEquTypeList();
     AddModel={};
     AddModel.MapId=MapId;
     IsAllCheck=true;
     ">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="page-heading">
        <h1>设置消防设施点位</h1>
        <div class="options">
            <div class="btn-toolbar">

            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>消防管理</a></li>
        <li><a>设施点位标识</a></li>
        <li class="active"><a>设置消防设施点位</a></li>
    </ol>

    <div class="container-fluid">
        <div class="row">
            <form class="form-horizontal row-border">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading"><h2>{{MapDetailInfo.PlaceName}}-设置点位</h2></div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6">
                                    <img id="mapContent" ng-src="{{MapDetailInfo.ImageInfo.FilePath}}" class="img-responsive" style="width:100%;" />
                                    @*<span id="location" class="fa fa-thumb-tack">
                                    </span>*@
                                    <img id="location" src="~/Assets/img/cursor.png" style="width:30px;height:30px;"/>
                                    <div ng-repeat="x in PointList" class="div-a" ng-style="{'left':(x.X*100)+'%','top':(x.Y*100)+'%'}">
                                        <a ng-mouseover="doMapMouse('struct',x.Id)" ng-mouseleave="MouseLeave('struct',x.Id)">
                                            <img ng-src="{{x.EquType.ImageInfo.FilePath}}" width="30" />
                                        </a>
                                        <div class="detail_div">
                                            <div id="struct{{x.Id}}" class="detail_text">
                                                <span style="top: -2px; position: relative;padding:5px;"><span class="glyphicon glyphicon-play"> </span><b>类型：</b><span>{{x.EquType.TypeName}}</span></span><br />
                                                <span style="top: -2px; position: relative;padding:5px;"><span class="glyphicon glyphicon-play"> </span><b>设备编号：</b><span>{{x.EquNo}}</span></span><br />
                                                <span style="top: -2px; position: relative;padding:5px;"><span class="glyphicon glyphicon-play"> </span><b>有效期：</b><span>{{x.ValidDate|JSONDate:'yyyy-MM-dd'}}</span></span><br />
                                                <span style="top: -2px; position: relative;padding:5px;"><span class="glyphicon glyphicon-play"> </span><b>备注：</b><span>{{x.Remark}}</span></span><br />
                                                <span style="top: -2px; position: relative;padding:5px;"><span class="glyphicon glyphicon-play"> </span><b>现场照片：</b><span><img ng-src="{{x.ImageInfo.FilePath}}" width="30" /></span></span><br />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">设施类型：</label>
                                        <div class="col-sm-6">
                                            <select class="form-control" ng-model="AddModel.EquTypeId">
                                                <option value="" selected>请选择设施类型</option>
                                                <option ng-repeat="x in TypeList" value="{{x.Id}}">{{x.TypeName}}</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">编号：</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" ng-model="AddModel.EquNo" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">位置：</label>
                                        <div class="col-sm-3">
                                            <input type="text" class="form-control" id="h_XAxis" />
                                        </div>
                                        <div class="col-sm-3">
                                            <input type="text" class="form-control" id="h_YAxis" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">有效期：</label>
                                        <div class="col-sm-6">
                                            <datepicker id="startTime" option="datetimeOption" format="L" dropzone="" ng-model="AddModel.ValidDate"></datepicker>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">备注：</label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" ng-model="AddModel.Remark" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">现场照片：</label>
                                        <div class="col-sm-6">
                                            <input type="file" class="form-control" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-2">
                                        </div>
                                        <div class="col-sm-2">
                                            <button class="btn btn-primary" ng-click="SubmitPoint(AddModel);">提交</button>
                                        </div>
                                        <div class="col-sm-1">
                                            <a class="btn btn-default">返回</a>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="row">
            <form class="form-horizontal row-border">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading"><h2>{{MapDetailInfo.PlaceName}}-点位列表</h2></div>
                        <div class="panel-body">
                            <div class="row">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th><a ng-click="SelectAll('chk_id');">全选</a></th>
                                            <th>序号</th>
                                            <th>类型</th>
                                            <th>编号</th>
                                            <th>有效期</th>
                                            <th>备注</th>
                                            <th>上传时间</th>
                                            <th>上传人</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="PointList==null || PointList.length==0">
                                            <td colspan="8">暂未上传</td>
                                        </tr>
                                        <tr ng-repeat="x in PointList">
                                            <td><input type="checkbox" name="chk_id" id="chk_{{x.Id}}"></td>
                                            <td>{{$index+1}}</td>
                                            <td>{{x.EquType.TypeName}}</td>
                                            <td>{{x.EquNo}}</td>
                                            <td>{{x.ValidDate|JSONDate:'yyyy-MM-dd'}}</td>
                                            <td>{{x.Remark}}</td>
                                            <td>{{x.UpdateTime|JSONDate:'yyyy-MM-dd HH:mm'}}</td>
                                            <td>{{x.UpdateUser}}</td>
                                            <td>
                                                <a href="#EditEqu" ng-click="GetCurrentModel(x);" data-toggle="modal" class="btn btn-default btn-xs btn-label"><i class="fa fa-pencil"></i>编辑</a>
                                                <a ng-click="DeleteEquPoint(x.Id,MapId);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="panel-footer">
                            <a data-toggle="modal" href="#UpdateEqu" class="btn btn-primary">批量更新</a>
                            <a class="btn btn-danger">批量删除</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="modal fade" id="UpdateEqu" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="min-width:985px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h2 class="modal-title">更新设施设备</h2>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form">
                            <div class="form-group">
                                <label for="inputStandard" class="col-lg-2 control-label">编号</label>
                                <div class="col-lg-3">
                                    <input type="text" class="form-control" placeholder="" maxlength="200" ng-model="UpdateModel.EquNo" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputStandard" class="col-lg-2 control-label">有效期</label>
                                <div class="col-lg-3">
                                    <datepicker id="startTime" option="datetimeOption" format="L" dropzone="" ng-model="UpdateModel.ValidDate"></datepicker>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="UpdateEquList(UpdateModel);">提交</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close2">关闭</button>
                    </div>
                </div>
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

        <div class="modal fade" id="EditEqu" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" style="min-width:985px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h2 class="modal-title">更新设施设备</h2>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">设施类型：</label>
                                <div class="col-sm-8">
                                    <select class="form-control" ng-model="CurrentPoint.EquTypeId">
                                        <option value="" selected>请选择设施类型</option>
                                        <option ng-repeat="x in TypeList" value="{{x.Id}}">{{x.TypeName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">编号：</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" ng-model="CurrentPoint.EquNo" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">位置：</label>
                                <div class="col-lg-10">
                                    <img id="mapContent2" ng-src="{{MapDetailInfo.ImageInfo.FilePath}}" class="img-responsive" style="width:100%;" />

                                    <img id="location2" src="~/Assets/img/cursor.png" style="" ng-style="{'left':(CurrentPoint.X*100)+'%','top':(CurrentPoint.Y*100)+'%','width':'30px','height':'30px'}"/>
                                </div>
                                <div class="col-sm-2">
                                   
                                </div>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="h_XAxis2" ng-model="CurrentPoint.X" readonly/>
                                </div>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="h_YAxis2" ng-model="CurrentPoint.Y" readonly/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">有效期：</label>
                                <div class="col-sm-6">
                                    <datepicker id="startTime" option="datetimeOption" format="L" dropzone="" ng-model="CurrentPoint.ValidDate"></datepicker>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注：</label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control" ng-model="CurrentPoint.Remark" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">现场照片：</label>
                                <div class="col-sm-6">
                                    <input type="file" class="form-control" />
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="EditPoint(CurrentPoint)">提交</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close2">关闭</button>
                    </div>
                </div>
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

    </div>
</div>


@section Js{
    <script src="~/Assets/js/pg/FireControl.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Assets/js/libs/moment.min.js"></script>
    <script src="~/Assets/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Assets/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Assets/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Assets/js/libs/fileinput.js"></script>
    <script src="~/Assets/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });

        $("#mapContent").mousedown(function (e) {
            var width = $("#mapContent").width();
            var height = $("#mapContent").height();
            mouseX1 = (e.pageX - $("#mapContent").offset().left) / width-0.015;
            mouseY1 = (e.pageY - $("#mapContent").offset().top) / height - 0.017;
            $("#location").css({ 'left': mouseX1 * 100 + '%', 'top': mouseY1 * 100 + '%' });
            $("#h_XAxis").val(mouseX1);
            $("#h_YAxis").val(mouseY1);
        });

        $("#mapContent2").mousedown(function (e) {
            var width = $("#mapContent2").width();
            var height = $("#mapContent2").height();
            mouseX1 = (e.pageX - $("#mapContent2").offset().left) / width - 0.015;
            mouseY1 = (e.pageY - $("#mapContent2").offset().top) / height - 0.017;
            $("#location2").css({ 'left': mouseX1 * 100 + '%', 'top': mouseY1 * 100 + '%' });
            $("#h_XAxis2").val(mouseX1);
            $("#h_YAxis2").val(mouseY1);
        });
    </script>
}

